<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:30:"./themes/admin/menu/index.html";i:1741049647;s:51:"/lysoo/syzth.lysoo.com/syzth/themes/admin/base.html";i:1741049647;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $setup['title']; ?></title>
    <meta content="<?php echo $setup['keywords']; ?>" name="keywords" />
    <meta content="<?php echo $setup['description']; ?>" name="description" />
    <?php if($setup['ico'] != null): ?><link rel="shortcut icon" type="image/x-icon"  href="/public/uploads/<?php echo $setup['ico']; ?>"/><?php endif; ?>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/public/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/public/layuiadmin/style/admin.css" media="all">
    <!--CSS引用-->
    
    <!--页面CSS-->
    <!--[if lt IE 9]>
    <script src="/public/static/js/html5shiv.min.js"></script>
    <script src="/public/static/js/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<!--tab标签-->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">模版设置</li>
                <li class=""><a href="<?php echo url('admin/menu/add'); ?>">添加模版</a></li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form" action="">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th style="width: 30px;">ID</th>
                                <th style="width: 30px;">排序</th>
                                <th>模版名称</th>
                                <th>控制器方法</th>
                                <th>状态</th>
                                <th style="width: 120px;">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(is_array($admin_menu_level_list) || $admin_menu_level_list instanceof \think\Collection || $admin_menu_level_list instanceof \think\Paginator): if( count($admin_menu_level_list)==0 ) : echo "" ;else: foreach($admin_menu_level_list as $key=>$vo): ?>
                            <tr>
                                <td><?php echo $vo['id']; ?></td>
                                <td><?php echo $vo['sort']; ?></td>
                                <td><?php if($vo['level'] != '1'): ?>|<?php for($i=1;$i<$vo['level'];$i++){echo ' ----';} endif; ?> <?php echo $vo['title']; ?></td>
                                <td><?php echo $vo['url']; ?></td>
                                <td><input type="checkbox" name="status" lay-skin="switch" lay-filter="switchTest" value="<?php echo $vo['id']; ?>" lay-text="显示|隐藏" <?php if($vo['status']==1): ?>checked<?php endif; ?>></td>
                                <td>
                                    <div class="layui-btn-group">
                                        <?php if($vo['level'] != '4'): ?><a href="<?php echo url('admin/menu/add',['pid'=>$vo['id']]); ?>" class="layui-btn layui-btn-sm" title="添加子模版"><i class="layui-icon">&#xe654;</i></a><?php endif; ?>
                                        <a href="<?php echo url('admin/menu/edit',['id'=>$vo['id']]); ?>" class="layui-btn layui-btn-sm" title="编辑"><i class="layui-icon">&#xe642;</i></a>
                                        <a href="<?php echo url('admin/menu/delete',['id'=>$vo['id']]); ?>" class="layui-btn layui-btn-sm ajax-delete" title="删除"><i class="layui-icon">&#xe640;</i></a>
                                    </div>
                                </td>
                            </tr>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--页面-->

<!--JS引用-->
<script src="/public/static/js/jquery.min.js"></script>
<script src="/public/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/public/layuiadmin/' //静态资源所在路径
    }).extend({
        index: "lib/index" //主入口模块
    }).use('index');
</script>

<script>
    layui.use(['layer','form'], function(){ //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
        var form = layui.form;

        /**
         * 通用删除
         */
        $('.ajax-delete').on('click', function () {
            var _href = $(this).attr('href');
            layer.open({
                shade: false,
                content: '确定删除？',
                btn: ['确定', '取消'],
                yes: function (index) {
                    $.ajax({
                        url: _href,
                        type: "get",
                        success: function (info) {
                            if (info.code === 1) {
                                setTimeout(function () {
                                    location.href = info.url;
                                }, 1000);
                            }
                            layer.msg(info.msg);
                        }
                    });
                    layer.close(index);
                }
            });

            return false;
        });


        //监听指定开关
        form.on('switch(switchTest)', function(data){
            if(this.checked==true){
                var status=1;
            }else{
                var status=0;
            }
            $.ajax({
                url: "<?php echo url('admin/menu/update'); ?>?id="+this.value+"&status="+status,
                type: "get",
                success: function (info) {
                    setTimeout(function () {
                        location.href = info.url;
                    }, 1000);
                    layer.msg(info.msg);
                }
            });
            return false;
        });

    });
</script>

<!--页面JS脚本-->
</body>
</html>

